async function async1() {
    console.log('async1 start');//2
    await async2();
    console.log('async1 end');//6
}

async function async2() {
    console.log('async2');//3
}
console.log('script start');//1
setTimeout(function () {
    console.log('setTimeout');//8
}, 0)
async1();
new Promise(function (resolve, rej) {
    console.log('promise1');//4
    // 
    resolve('1111');
}).then(function (a) {
    console.log('promise2');//7
}).catch(
    () => {

    }
);
console.log('script end');//5


// async function async1() {
// 	console.log('async1 start');
// 	await async2();
// 	console.log('async1 end');
// }等价于 
// 实际上await是一个让出线程的标志。await后面的表达式会先执行一遍，将await后面的代码加入到microtask中，然后就会跳出整个async函数来执行后面的代码。
async function async1() {
    console.log('async1 start');
    Promise.resolve(async2()).then(() => {
        console.log('async1 end');
    })
}
/*
script start
async1 start
async2
promise1
script end
async1 end
promise2
setTimeout
*/